package edu.uwm.capstone.diasmart.database;

import java.util.Arrays;

import android.content.Context;
import android.util.Log;
import edu.uwm.capstone.diasmart.R;

public class SystemData {
	private static SubType SUBTYPE_UNFILED = null;
	private static Category[] SYSTEM_CATEGORIES = new Category[9];
	private static SubType[] SYSTEM_SUB_TYPES = new SubType[5];
	private static Category UNFILED_CATEGORY = null;

	public static Category[] getSystemCategories(Context paramContext) {

		SYSTEM_CATEGORIES[0] = getSystemUnfiledCategory(paramContext);
		SYSTEM_CATEGORIES[1] = new Category(
				paramContext.getString(R.string.breakfast), false);
		SYSTEM_CATEGORIES[2] = new Category(
				paramContext.getString(R.string.after_breakfast), false);
		SYSTEM_CATEGORIES[3] = new Category(
				paramContext.getString(R.string.lunch), false);
		SYSTEM_CATEGORIES[4] = new Category(
				paramContext.getString(R.string.after_lunch), false);
		SYSTEM_CATEGORIES[5] = new Category(
				paramContext.getString(R.string.dinner), false);
		SYSTEM_CATEGORIES[6] = new Category(
				paramContext.getString(R.string.after_dinner), false);
		SYSTEM_CATEGORIES[7] = new Category(
				paramContext.getString(R.string.sick), false);
		SYSTEM_CATEGORIES[8] = new Category(
				paramContext.getString(R.string.snack), false);
		Log.d("Diasmart", Arrays.toString(SYSTEM_CATEGORIES));
		return SYSTEM_CATEGORIES;
	}

	public static SubType[] getSystemSubTypes(Context paramContext) {

		SYSTEM_SUB_TYPES[0] = getSystemUnfiledSubType(paramContext);
		SYSTEM_SUB_TYPES[1] = new SubType(3, "Humalin", false);
		SYSTEM_SUB_TYPES[2] = new SubType(3, "Humalog", false);
		SYSTEM_SUB_TYPES[3] = new SubType(2,
				paramContext.getString(R.string.running), false);
		SYSTEM_SUB_TYPES[4] = new SubType(2,
				paramContext.getString(R.string.walking), false);

		return SYSTEM_SUB_TYPES;
	}

	public static Category getSystemUnfiledCategory(Context paramContext) {
		if (UNFILED_CATEGORY == null)
			UNFILED_CATEGORY = new Category(
					paramContext.getString(R.string.unfiled), true);
		return UNFILED_CATEGORY;
	}

	public static SubType getSystemUnfiledSubType(Context paramContext) {
		if (SUBTYPE_UNFILED == null)
			SUBTYPE_UNFILED = new SubType(99,
					paramContext.getString(R.string.unfiled), true);
		return SUBTYPE_UNFILED;
	}
}